package com.example.basemvp.base;

import android.content.Context;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

/**
 * Created by jie on 2017/6/23.
 */

public abstract class BasePresenter<V extends IView> implements IPresenter {
    public Context mContext;
    public V mView;
    private CompositeDisposable mDisposables;

    public void onSetView(V view) {
        mView = view;
    }
    @Override
    public void onCreate() {
        mDisposables = new CompositeDisposable();

    }

    @Override
    public void onStart() {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onStop() {

    }

    @Override
    public void onDestroy() {
        mDisposables.dispose();
        mDisposables.clear();
        mDisposables = null;
    }

    protected void addDisposable(Disposable disposable) {
        mDisposables.add(disposable);
    }


}
